<template>
  <view @click="searchHandler" class="my-search-container" :style="{ backgroundColor:bgColor }">
    <view hover-class="hoverClass" class="my-search-box" :style="{ borderRadius:radius+'px' }" >
      <uni-icons type="search" size="20"></uni-icons>
      <text>搜索</text>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    data() {
      return {
        
      };
    },
    props:{
      bgColor:{
        type:String,
        default:'#c00000'
      },
      radius:{
        type:Number,
        // 单位 px
        default:18
      }
    },
    methods:{
      searchHandler() {
        this.$emit('myClick')
      }
    }
  }
</script>

<style lang="scss">
  .my-search-container {
    display: flex;
    align-items: center;
    justify-content: center;
     width: 100%;
     height: 100rpx;
  .hoverClass {
  position: relative;
  &::before {
    position: absolute;
    top: 0;
    left: 0;
    content: ' ';
    width: 100%;
    height: 100%;
   border-radius: 18px;
    background-color: #fff;
    opacity: .4;
  }
  }
 .my-search-box {
   width: 92%;
   height: 72rpx;
   background-color: #f7f7f7;
   text-align: center;
   line-height: 72rpx;
   text {
     margin-left: 10rpx;
     vertical-align: middle;
   }
 }
 }
</style>